<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<c-rt:if test="${!empty param.questionID || !empty param.id}">
	<c-rt:if test="${!empty param.questionID}">
		<c-rt:set var="questionID">${param.questionID}</c-rt:set>
	</c-rt:if> 
	<c-rt:if test="${!empty param.id}">
		<c-rt:set var="questionID">${param.id}</c-rt:set>
	</c-rt:if>
	
	<c-rt:set var="question" value="${pu:get('com.yaodian100.crm.cs.entity.Question', questionID)}"/>
</c-rt:if>
<c-rt:set var="questionTypes" value="${pu:queryByHql('from QuestionType', null, null)}"/>
<c-rt:set var="fromChannels" value="${pu:queryByHql('from FromChannel', null, null)}"/>
	<script language="javascript">
	$(document).ready( function() {
		$('#submit_button').click(function(){
			message='';
			if(document.theForm.fromChannel.value==''){
				message+='请选择channel\r\n';
			}
			if(document.theForm.questionType.value==''){
				message+='请选择问题单类型\r\n';
			}
			if(message==''){
				doAR('<%=application.getContextPath() %>/cs/update.do', 'main', 'theForm');
			}else{
				alert(message);
			}
		});
	});
	</script>

<s:actionerror/>
<s:actionmessage/>
<s:fielderror />
<br/>
<h1>
<c-rt:if test="${empty question}">
新增
</c-rt:if>
<c-rt:if test="${!empty question}">
修改
</c-rt:if>
问题单</h1>
<c-rt:if test="${!empty param.operation}">
<c-rt:if test="${empty question}">
已储存！
</c-rt:if>
<c-rt:if test="${!empty question}">
已储存修改！
</c-rt:if>
</c-rt:if>
<form method="post" id="theForm" name="theForm">
<c-rt:if test="${empty question}">
<input type="hidden" name="operation" value="save"/>
</c-rt:if>
<c-rt:if test="${!empty question}">
<input type="hidden" name="operation" value="update"/>
</c-rt:if>
<table class="tb-data" width="100%">
<tr><th width="130px">questionID</th><td>${question.id}<input type="hidden" name="id" value="${question.id }"/></td></tr>
<tr><th>channel</th>
<td>
<select name="fromChannel">
<option value="">请选择</option>
<c-rt:forEach items="${fromChannels }" var="fc">
<option value="${fc.id }" <c-rt:if test="${question.channel.id==fc.id }">selected="selected"</c-rt:if>>${fc.title }</option>
</c-rt:forEach>
</select>
</td>
</tr>
<tr><th width="130px">问题单类型</th><td>
<select name="questionType">
<option value="">请选择</option>
<c-rt:forEach items="${questionTypes}" var="qt">
<option value="${qt.id }" <c-rt:if test="${question.type.id==qt.id }">selected="selected"</c-rt:if>>${qt.name }</option>
</c-rt:forEach>
</select>
</td></tr>
<tr><th>会员</th><td><input type="hidden" id="memberId" name="memberId" value="${question.memberId }"/>
<c-rt:if test="${!empty question.memberId}">
<c-rt:set var="member" value="${pu:get('com.yaodian100.ec.member.entity.Member', question.memberId)}"/>
</c-rt:if>
<input type="text" id="member" name="member" value="${member.name }" readonly="readonly"/> <a href="javascript:doAR('<%=application.getContextPath() %>/cs/page.do?iamlazy=memberList&AJAX=true&refreshZone=dialog&returnFieldIds=memberId,member','dialog');openDialog('select')">select</a></td></tr>
<tr><th width="130px">短描述</th><td><input type="text" name="shortDesc" value="${question.shortDesc }"/></td></tr>
<tr><th width="130px">描述</th><td><input type="text" name="description" value="${question.description }"/></td></tr>
	<tr>
	<th></th><td><input type="button" id="submit_button" value="送出"/>
	<input type="reset" value="重设"/>
	</td>
	</tr>
	
	</table>
</form>

